#import "RNFilteredListDetailHeader.h"
#import "Aisle.h"
#import "RNConstants.h"

@implementation RNFilteredListDetailHeader

+(NSArray *)arrayOfHeadersWithRootObject:(id)rootObject filteredWithObject:(id)filterObject inManagedObjectContext:(NSManagedObjectContext *)moc {
    RNFilteredListDetailHeader *header1 = [[self alloc] initWithRootObject:rootObject];
    [[header1 primaryController] setFilterPredicate:[NSPredicate predicateWithFormat:@"store == %@", filterObject]];
    [Aisle setCurrentListObject:rootObject];
    [Aisle setShowsChildren:YES];
    return [NSArray arrayWithObjects:header1, nil];
}

-(id)initWithRootObject:(id)rootObject {
    if (!(self = [super initWithRootObject:rootObject]))
        return nil;
    
    [self setKeyPath:@"items.@distinctUnionOfSets.aisles"];
    [self setHeaderHeight:RNHiddenHeaderHeight];

    return self;
}

@end
